﻿using Shop.RemoteModel.CouponGoods.Model;
using Shop.StoreGatewayModular.Interface;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Api
{
    [ApiRouteName("/shop/coupon/goods/{name}")]
    internal class CouponGoodsApi : ApiController
    {
        private readonly ICouponGoodsService _Service;

        public CouponGoodsApi (ICouponGoodsService service)
        {
            this._Service = service;
        }

        public void Delete ([NumValidate("shop.coupon.goods.id.error", 1)] long id)
        {
            this._Service.Delete(id);
        }

        public void BatchDelete (LongParam<long[]> param)
        {
            this._Service.Delete(param.Id, param.Value);
        }

        public CouponSkuDatum[] Gets ([NumValidate("shop.coupon.id.error", 1)] long couponId)
        {
            return this._Service.Gets(couponId);
        }

        public CouponSkuDatum[] Set (LongParam<CoupGoods[]> param)
        {
            return this._Service.Set(param.Id, param.Value);
        }
    }
}
